package com.cvo.scrumtoolkit.client.pannels;

import com.cvo.scrumtoolkit.client.services.ScrumToolService;
import com.cvo.scrumtoolkit.client.services.ScrumToolServiceAsync;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class BacklogItemPanel extends Composite  {
	
	int nownr;
	private static ItemshowUiBinder uiBinder = GWT
			.create(ItemshowUiBinder.class);
	private final ScrumToolServiceAsync scrumtoolService = GWT.create(ScrumToolService.class);
	interface ItemshowUiBinder extends UiBinder<Widget, BacklogItemPanel> {
	}
	public BacklogItemPanel() {
		initWidget(uiBinder.createAndBindUi(this));
	}

	
	@UiField
	Button buttonplus;
	
	@UiField
	Button buttonmin;
	
	@UiField
	Label discription;
	
	@UiField
	TextBox storrypoints;
	
	@UiField
	Label itemname;
	
	@UiField
	Label prioritivalue;


//	public BacklogItemPanel(Itemclass itemclass, Hulpclass hulpclass) {
//		this.itemclass=itemclass;
//		this.hulpclass=hulpclass;
//		initWidget(uiBinder.createAndBindUi(this));
//		itemname.setText(itemclass.getItemname());
//		discription.setText(itemclass.getItemdiscription());
//		prioritivalue.setText(""+itemclass.getPrioriteit());
//		buttonplus.setText("+");
//		buttonmin.setText("-");
//		nownr=(hulpclass.getList().indexOf(itemclass));
//		if (hulpclass.getList().size()-1==hulpclass.getList().indexOf(itemclass)){
//			buttonplus.setEnabled(false);
//		}
//		if (hulpclass.getList().indexOf(itemclass)==0){
//			buttonmin.setEnabled(false);
//		}
//		
//		//System.out.println(nownr);
//
//	}
	
	@UiHandler("storrypoints")
	void onchange(ValueChangeEvent<String> event)
	{
		
	}
	
	@UiHandler("buttonplus")
	void onPlus(ClickEvent e) {
//		Itemclass x=(hulpclass.getList().get(nownr+1));
//		scrumtoolService.updateItem(itemclass, x, new AsyncCallback<Void>() {
//			
//			@Override
//			public void onSuccess(Void result) {
//					
//			}
//			
//			@Override
//			public void onFailure(Throwable caught) {
//				
//			}
//		});
	}
	@UiHandler("buttonmin")
	void onMin(ClickEvent e) {
//		Itemclass x=(hulpclass.getList().get(nownr-1));
//		scrumtoolService.updateItem(itemclass, x, new AsyncCallback<Void>() {
//			
//			@Override
//			public void onSuccess(Void result) {
//				
//			}
//			
//			@Override
//			public void onFailure(Throwable caught) {
//				
//			}
//		});
	}
}
